package com.study.system.course.controller;

import com.study.system.course.config.RabbitMQConfig;
import jakarta.annotation.Resource;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RabbitMQTestController {

    @Resource
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("/sendMessage")
    public String sendMessage(String msg,String key){
        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_COURSE,key,msg);
        return "发送完成";
    }
}
